//
//  JIUUserDataManager.m
//  JIUKeyChainTest
//
//  Created by JIUZhiYong on 16/6/12.
//  Copyright © 2016年 JIUiphone. All rights reserved.
//

#import "JIUUserDataManager.h"
#import "JIUKeyChain.h"

@implementation JIUUserDataManager


static NSString * const KEY_IN_KEYCHAIN = @"com.yulu.app.allinfo";
static NSString * const KEY_PASSWORD = @"com.yulu.app.password";

+ (id)readPassWord
{
    NSMutableDictionary *usernamepasswordKVPair = (NSMutableDictionary *)[JIUKeyChain getUserData:KEY_IN_KEYCHAIN];
    return [usernamepasswordKVPair objectForKey:KEY_PASSWORD];
}

+ (void)savePassWord:(NSString *)password
{
    NSMutableDictionary *usernamepasswordKVPairs = [NSMutableDictionary dictionary];
    [usernamepasswordKVPairs setObject:password forKey:KEY_PASSWORD];
    [JIUKeyChain saveUserDataKey:KEY_IN_KEYCHAIN dataValue:usernamepasswordKVPairs];
}

+ (void)deletePassWord
{
    [JIUKeyChain deleteUserData:KEY_IN_KEYCHAIN];
}

@end
